package nicepc.mapper;

import nicepc.pojo.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

//这是一个mybatis的mapper
@Mapper
@Repository
//@CacheNamespace
public interface UserMapper {

    @Select("select name,pwd from ${tableName}")
    List<User> selectUserList(@Param("tableName") String tableName);

//    List<User> getUserById(int id);

//    @Insert("insert into ${tableName} (${fields}) values (${values})")
//    int addUser(@Param("fields") String fields, @Param("tableName") String tableName, @Param("values") String values);

    @Insert("insert into ${tableName}(name,pwd) values (#{name},#{pwd})")
    int addUser(User user);

//    int updateUser(User user);

//    int deleteUser(int id);

//    @Select("SELECT ${fields} FROM ${tableName} WHERE id in (${ids})")
//    Map<String, Object> selectids(@Param("tableName") String tableName,@Param("ids") String ids,@Param("fields") String fields);
}
